package cn.damai.search.baseService.ipml;

import cn.damai.search.baseService.BaseSchedulerService;
import cn.damai.search.mapper.SchedulerMapper;
import cn.damai.model.Scheduler;
import cn.damai.util.DubboUtil;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Component
@Service(version = DubboUtil.VRESION,group = DubboUtil.GROUP)
public class BaseSchedulerServiceIpml implements BaseSchedulerService {

    @Autowired
    private SchedulerMapper SchedulerMapper;

    @Override
    public Scheduler getSchedulerById(@RequestParam Long id){
        return SchedulerMapper.getSchedulerById(id);
    }

    @Override
    public List<Scheduler>	getSchedulerListByMap(@RequestParam Map<String,Object> param){
        return SchedulerMapper.getSchedulerListByMap(param);
    }

    @Override
    public Integer getSchedulerCountByMap(@RequestParam Map<String,Object> param){
        return SchedulerMapper.getSchedulerCountByMap(param);
    }

    @Override
    public Integer qdtxAddScheduler(@RequestParam Scheduler Scheduler){
        Scheduler.setCreatedTime(new Date());
        return SchedulerMapper.insertScheduler(Scheduler);
    }

    @Override
    public Integer qdtxModifyScheduler(@RequestParam Scheduler Scheduler){
        Scheduler.setUpdatedTime(new Date());
        return SchedulerMapper.updateScheduler(Scheduler);
    }
}
